package com.railwayservice.messages.vo;

import java.util.HashMap;
import java.util.Map;

/**
 * 微信消息参数对象。
 *
 * @author Ewing
 * @date 2017/5/4
 */
public class WechatTMessage {

    public String touser;
    public String template_id;
    public String url;
    public String topcolor = "#FF6600";

    public Map<String, Data> data = new HashMap<>();

    public static class Data {
        public String value;
        public String color = "#000000";

        public Data(String value) {
            this.value = (value == null ? "" : value);
        }

        public Data(String value, String color) {
            this.value = (value == null ? "" : value);
            this.color = (color == null ? "#000000" : color);
        }
    }

    public WechatTMessage addData(String key, String value) {
        this.data.put(key, new Data(value));
        return this;
    }

    public WechatTMessage addData(String key, String value, String color) {
        this.data.put(key, new Data(value, color));
        return this;
    }

}
